#if 1
#include <stdint.h>
#include "contract.h"

#if 0
uint8_t Buffer_Xor(uint8_t buf[], uint32_t len)
{
    uint32_t i;
    uint8_t xor;

    REQUIRE(buf);

    for(xor = i = 0; i < len; i++)
    {
        xor ^= buf[i];
    }

    return xor;
}
#endif 
#if 0
/*Count the set bit in byte*/
uint8_t CountSetBit(uint8_t byte)
{
    static const uint8_t setbit_number_table[16] =
    /*0, 1,  2,  3,   4,  5,  6,   7,  8,  9,   A,  B,  C,  D,  E,   F*/
    {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};

    return setbit_number_table[byte & 0x0F] + setbit_number_table[byte >> 4];
}
#endif 

#if 0
uint16_t Odd(uint8_t data, uint8_t data_bits)
{
    uint16_t odd;
    uint8_t set_bit_count = 0;

    odd = data & (uint8_t)(0xFF >>(8 - data_bits));
    set_bit_count = CountSetBit(odd);
    if((set_bit_count & 1) == 0)
    {
        odd |= (1u << data_bits);
    }

    return odd;
}
#endif 

#if 0
void BitBuffer_Put(uint8_t bit_buffer[], uint32_t position, uint8_t val)
{
    uint32_t byte_offset = position / 8;
    uint32_t bit_offset = position % 8;

    if(val != 0)
    {
        bit_buffer[byte_offset] |= 1u <<  bit_offset;
    }
    else
    {
        bit_buffer[byte_offset] &= ~(1u << bit_offset);
    }
}
#endif 

#if 0
uint8_t BitBuffer_Get(uint8_t bit_buffer[], uint32_t bit_num)
{
    uint32_t byte_offset = bit_num / 8;
    uint32_t bit_offset = bit_num % 8;

    return (bit_buffer[byte_offset] >> bit_offset) & 0x01;
}
#endif 

#endif 

